package com.plan.service;

import com.plan.dao.AdminDao;
import com.plan.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class AdminServiceImpl implements AdminService{
    @Autowired
    private AdminDao adminDao;
    @Override
    public void register(User user) {
        adminDao.register(user);
    }

    @Override
    public List<User> findAllUser(Integer page, Integer rows) {
        int start=(page-1)*rows;
        return adminDao.findAllUser(start,rows);
    }

    @Override
    public Integer findTotalsUser() {
        return adminDao.totalsUser();
    }

    @Override
    public void saveUser(User user) {
        adminDao.saveUser(user);
    }

    @Override
    public User findUser(String id) {
        return adminDao.findOne(id);
    }
}
